Thumb

POS-27: Invoice sales page edit using ASP.NET MVC JQUERY AngularJS

Part-1: Point of Sale(POS) Inventory Super Shop Management System using ASP.NET MVC Part-2: Point of Sale(POS) Setup template to your project | Super Shop Management System|ASP.NET MVC Part-3: Point of Sale(POS) Database & table analysis | Super Shop Management System|ASP.NET MVC Part-4: Point of Sale(POS) Database Create in SQL Server | Super Shop Management System|ASP.NET MVC Part-5: Point of Sale(POS) Login using AJAX ASP.NET MVC | JQUERY Part-6: Point of Sale(POS) Login and Authorization with Session variables in ASP.NET | JQUERY | AJAX Part-7: Point of Sale(POS) Convert Password to MD5 Hash string in ASP.NET | Encrypt password in ASP.NET MVC C# Part-8: Point of Sale(POS) Role based authentication and authorization in ASP.NET MVC|Redirect to not found page if not authorized|C# Part-9: Point of Sale(POS) Create user & Account management UI UX in ASP.NET MVC Part-10: Point of Sale(POS) User Creation & user registration using ASP.NET MVC | Jquery | Ajax Part-11: Point of Sale(POS) Get user list using ASP.NET MVC | Jquery | Ajax Part-12: Point of Sale(POS) Update user using ASP.NET MVC | Jquery | Ajax Part-13: Inventory and POS Login logout session using ASP.NET | Supershop management system Part-14: Inventory Category CRUD Create,Retrieve,Update,View | POS Category CRUD using ASP.NET JQuery AJAX Part-15: Inventory and POS batch tracking and control table create in SQL Server 2012 Part-16: Inventory Product CRUD List | Point of sale Products Crud using asp.net MVC Part-17: Inventory and POS Batch CRUD using asp.net MVC JQUERY AJAX | CSharp Part-18: Inventory management and stock control using asp.net mvc | Jquery AngularJs Part-19: Inventory & POS Stock edit and validation using asp.net AngularJS POS 20: Inventory & POS AngularJS error fix POS-21: Inventory & POS Invoice template setup using Bootstrap POS-22: Invoice Adding input fields & adding rows Dynamically using Javascript | ASP.NET MVC | AngularJs POS-23: Inventory Onclick get selected data & Calculate line total using Javascript ASP.NET MVC JQUERY POS-24: Inventory Invoice Configuration and Calculation using JavaScript AngularJS ASP.NET MVC POS-25: Inventory sale from invoice using ASP.NET MVC | Jquery AngularJS POS-26: Get data using ASP.NET MVC AngularJS JQUERY POS-27: Invoice sales page edit using ASP.NET MVC JQUERY AngularJS POS-28: Invoice vat calculation discount calculation using Javascript ASP.NET MVC | Invoice crud asp.net POS-29: Invoice calculate subtotal add row remove row using AngularJS ASP.NET MVC

7/23/2021 6:17:30 PM

Post your any code related problem to www.abctutorial.com

Follow the previous video and articles to complete the POS tutorials

Step-1:

  • Use this below invoice template code inside your ng-controller=”HomeInvoiceList”
<div class="card" ng-show="invoice">
        <div class="card-header">
            Order
            <strong>{{Sale.OrderNo}}</strong>
            <span class="float-right"> <a class="btn btn-success" ng-click="SaveInvoice()">Save</a></span>

        </div>
        <div class="card-body">
            <div class="row mb-4">
                <div class="col-sm-6">
                    <div>
                        <strong>abctutorial</strong>
                    </div>
                    <div>Madalinskiego 8</div>
                    <div>71-101 Szczecin, Poland</div>
                    <div>Email: info@webz.com.pl</div>
                    <div>Phone: +48 444 666 3333</div>
                </div>

                <div class="col-sm-6">
                    <div class="float-right">
                        <div>
                            <input type="text" ng-model="Sale.CustomerName" class="BorderLess" placeholder="Customer name" />
                        </div>
                        <div><textarea class="BorderLess" ng-model="Sale.CustomerAddress" placeholder="Address"></textarea></div>
                        <div><input class="BorderLess" ng-model="Sale.CustomerPhone" type="number" placeholder="Phone" /></div>
                    </div>
                </div>



            </div>

            <div class="table-responsive-sm">
                <table class="table table-striped">
                    <thead>
                        <tr>
                            <th class="center">#</th>
                            <th>Item</th>
                            <th>Category</th>

                            <th class="right">Unit Cost</th>
                            <th class="center">Qty</th>
                            <th class="right">Total</th>
                        </tr>
                    </thead>
                    <tbody>
                        <tr ng-repeat="cart in InvoiceCart">
                            <td class="center">{{$index+1}}</td>
                            <td class="left strong">
                                <select ng-model="cart.ProductId" ng-click="SetValueOfProduct(cart.ProductId);SubTotalCalculation();">
                                    <option>--Select--</option>
                                    <option ng-repeat="product in ProductList" value="{{product.ProductId}}">{{product.Name}}</option>
                                </select>
                            </td>
                            <td class="left">{{cart.CategoryName}}</td>

                            <td class="right"><input ng-model="cart.UnitPrice" value="{{cart.UnitPrice}}" /></td>
                            <td class="center"><input class="BorderLess" ng-model="cart.Quantity" ng-change="OnChangeLineTotalSet(cart.ProductId);SubTotalCalculation();" value="1" type="number" placeholder="Quantity" /></td>
                            <td class="right"><input value={{cart.Quantity*cart.UnitPrice}} ng-model="cart.LineTotal" /></td>
                            <td><a href="#" ng-click="RowDelete($index)"><i class="fa fa-times"></i></a></td>
                        </tr>
                        <tr>
                            <td>
                                <a href="#" ng-click="AddNewRow()"><i class="fa fa-plus"></i></a>
                            </td>
                        </tr>
                    </tbody>
                </table>
            </div>
            <div class="row">
                <div class="col-lg-4 col-sm-5">

                </div>

                <div class="col-lg-4 col-sm-5 ml-auto">
                    <table class="table table-clear">
                        <tbody>
                            <tr>
                                <td class="left">
                                    <strong>Subtotal</strong>
                                </td>
                                <td class="right">${{Sale.Subtotal}}</td>
                            </tr>
                            <tr>
                                <td class="left">
                                    <strong>
                                        Discount
                                        <select ng-model="Sale.DiscountParcentage" ng-click="CalculateDiscount()">
                                            <option value="">--Select--</option>
                                            <option value="10">10%</option>
                                            <option value="20">20%</option>
                                            <option value="30">30%</option>
                                        </select>
                                    </strong>
                                </td>
                                <td class="right">${{Sale.DiscountAmount}}</td>
                            </tr>
                            <tr>
                                <td class="left">
                                    <strong>
                                        VAT
                                        <select ng-model="Sale.VatParcentage" ng-click="CalculateVat()">
                                            <option value="">--Select--</option>
                                            <option value="10">10%</option>
                                            <option value="20">20%</option>
                                            <option value="30">30%</option>
                                        </select>
                                    </strong>
                                </td>
                                <td class="right">${{Sale.VatAmount}}</td>
                            </tr>
                            <tr>
                                <td class="left">
                                    <strong>Total</strong>
                                </td>
                                <td class="right">
                                    <strong>${{Sale.TotalAmout}}</strong>
                                </td>
                            </tr>
                        </tbody>
                    </table>
                </div>

            </div>
            <a href="#" class="btn btn-danger" ng-click="ShowHideEdit()"><i class="fa fa-times"></i>Cancel</a>

        </div>
    </div>
  • Use ng-show in sales list DIV
ng-show="list"
  • Change Sales list Detail Button column by this
<td><a href="#" class="btn btn-success" ng-click="ShowHideEdit();GetInvoiceSalesBySalesId(item.SalesId);"><i class="fa fa-edit"></i>Edit</a></td>
  • Create this below scope in HomeInvoiceListController.js
   		$scope.Sale = new Object();
       	$scope.list = true;
        $scope.invoice = false;
  • Add below method inside HomeInvoiceListController.js
             $scope.ShowHideEdit = function () {
            		 $scope.list = $scope.list == true ? false : true;
           		 $scope.invoice = $scope.invoice == true ? false : true;
        }
  • Add this method inside your HomeController.cs
        [HttpGet]
        public JsonResult GetInvoiceBySalesId(int salesId)
        {
            POS_TutorialEntities db = new POS_TutorialEntities();
            List<Sale> dataList = (from sd in db.SalesDetails.ToList()
                           join s in db.Sales on sd.SalesId equals s.SalesId
                           where sd.SalesId==salesId
                           select new Sale {
                               SalesId=(int)sd.SalesId,
                               OrderNo=s.OrderNo,
                               CustomerName=s.CustomerName,
                               CustomerPhone = s.CustomerPhone,
                               CustomerAddress = s.CustomerAddress,
                               OrderDate=s.OrderDate,
                               PaymentMethod = s.PaymentMethod,
                               TotalAmout = s.TotalAmout,
                               SalesDetailId = sd.SalesDetailId,
                               ProductId=sd.ProductId,
                               UnitPrice=sd.UnitPrice,
                               Quantity=sd.Quantity,
                               LineTotal=sd.LineTotal,
                               DiscountParcentage=s.DiscountParcentage,
                               VatParcentage = s.VatParcentage
                           }).ToList();
            return Json(dataList, JsonRequestBehavior.AllowGet);
        }
  • Add this method to your HomeInvoiceListController.js
       $scope.GetInvoiceSalesBySalesId = function (salesId) {
            $http.get('/Home/GetInvoiceBySalesId', { params: { salesId: salesId } })
                .then(function (response) {
                    var data = response.data;
                    $scope.SalesList = data;
                    $scope.Sale.OrderNo = $scope.SalesList[0].OrderNo;
                    $scope.Sale.CustomerName = $scope.SalesList[0].CustomerName;
                    $scope.Sale.CustomerAddress = $scope.SalesList[0].CustomerAddress;
                    $scope.Sale.CustomerPhone = parseInt($scope.SalesList[0].CustomerPhone);
                    $scope.Sale.Subtotal = $scope.SalesList[0].Subtotal;
                    $scope.Sale.DiscountParcentage = $scope.SalesList[0].DiscountParcentage;
              
                    $scope.Sale.VatParcentage = $scope.SalesList[0].VatParcentage;
          
                    $scope.Sale.TotalAmout = $scope.SalesList[0].TotalAmout;
                });
        }

Step-2:

  • Run the project

About Teacher

Reza Karim

Software Engineer

More about him